{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3273c18c",
   "metadata": {},
   "source": [
    "## IIR滤波器设计双线性变换法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4696347f",
   "metadata": {},
   "source": [
    "- 为了克服脉冲响应不变变换法可能产生的频谱混叠效应的缺点，凯塞 (Kaiser) 和戈尔登 (Golden) 建议用一种新的有效的变换，这就是双线性变换。双线性变换可认为是基于对微分方程的积分，利用对积分的数值逼近得到的。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "67323e87",
   "metadata": {},
   "source": [
    "- 利用脉冲响应不变变换法，把下列模拟域的模拟滤波器转换为数字滤波器，采样周期$T=1$\n",
    "$$H(s)=\\frac{s+1}{s^2+5s+6}$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c7741ad6",
   "metadata": {},
   "outputs": [],
   "source": [
    "#library\n",
    "import numpy as np\n",
    "from scipy import signal\n",
    "\n",
    "#analog filter transfer function\n",
    "b_analog = np.array([1,1]) #numerator\n",
    "a_analog = np.array([1,5,6]) #denominator\n",
    "T = 0.01;fs = 1/T #sampling rate\n",
    "\n",
    "#bilinear transformation method\n",
    "filtz = signal.bilinear(b_analog,a_analog,fs)\n"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdYAAABICAYAAABLAdTdAAAS3klEQVR4nO3dTWgbx/sH8K/+5KjUBAnql0uzwdapaZwgQ4pTnNgFObiX0Bg7JfKlVg4ldRrpkFxqp9ASqKzEhVJiu9A4YLmkhxTJVcGJmtSGgkskN+3FFtXNkikyxewecpvfIf/dSvsijVarF8vPB3ywNDu7q2d3Hu1qZ8bGGGMghBBCiCX+r94bQAghhDQTSqyEEEKIhSixEkIIIRaixEoIIYRYiBIrIYQQYiFKrIQQQoiFKLESQgghFqLESgghhFiIEishhBBiIUqshBBCiIUosRJCiMr09DRsNhump6frvSlkH6LESgghKn6/H5FIpN6bQfYpSqyEEEKIhSixEkI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XB7ttIyPMdZufvXaHG3knyMHDlyBKdOnSr5d/78eet+g7Xk2WJC/l89utvIXRDkgQRk2WyWhUIh1tXVpXlPFEU2NTXFlpeXlf9DoZCmG4O8Xnl5o+4e8jbk90ss1tdQ7kpRbnebRCLBurq6WCgUYqIoKn00i33eiUSCDQ8P63a/YezVgBP5XXBEUWTz8/OG9VWinD6vPJ99NWOv3g6j7b5+/bruQBz5/WatKsNznPHuXy3jXi8rKytsamqKrays1HS9lFiJZdR94qzq31aqXnXjKicth8Nh2IdPFEU2Pj6u1OnxeAz7+iUSCeZ2uxkA5na7DcuFw2Gl72BXV5fSsOkplliL7W8mk2H9/f3Ke263u+h6GHuVkIySgt7oPLB4hJ585Q4mUeqzr3bsSx17U1NTuskwP/lZVUZW6jjj2b9ax72e6pFcado4QgghTW11dRWrq6s4c+YMzpw5U/X1UWIlhBDS9P766y+0tbXV5OlgSqyEEEKIheipYEIIIcRClFgJIYQQC1FiJYQQQixEiZUQQgixECVWQgghxEKUWAkhhBALUWIlhBBCLESJlRBCCLEQJVZCCCHEQpRYCSGEEAtRYiWEEEIsRImVEEIIsRAlVkIIIcRClFgJIYQQC1FiJYQQQiz0P5K6xkWO/wyDAAAAAElFTkSuQmCC"
    }
   },
   "cell_type": "markdown",
   "id": "76546997",
   "metadata": {},
   "source": [
    "![image.png](attachment:image.png)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
